profiling
[lhc/web/wiklou.git] / maintenance / updaters.inc
1 <?php
2 /**
3 * @package MediaWiki
4 * @subpackage Maintenance
5 */
6
7 /** */
8
9 require_once 'convertLinks.inc';
10 require_once 'InitialiseMessages.inc';
11
12 $wgRenamedTables = array(
13 # from to patch file
14 array( 'group', 'groups', 'patch-rename-group.sql' ),
15 );
16
17 $wgNewTables = array(
18 # table patch file (in maintenance/archives)
19 array( 'linkscc', 'patch-linkscc.sql' ),
20 array( 'hitcounter', 'patch-hitcounter.sql' ),
21 array( 'querycache', 'patch-querycache.sql' ),
22 array( 'objectcache', 'patch-objectcache.sql' ),
23 array( 'categorylinks', 'patch-categorylinks.sql' ),
24 array( 'logging', 'patch-logging.sql' ),
25 array( 'user_rights', 'patch-user_rights.sql' ),
26 array( 'groups', 'patch-userlevels.sql' ),
27 array( 'validate', 'patch-validate.sql' ),
28 );
29
30 $wgNewFields = array(
31 # table field patch file (in maintenance/archives)
32 array( 'ipblocks', 'ipb_id', 'patch-ipblocks.sql' ),
33 array( 'ipblocks', 'ipb_expiry', 'patch-ipb_expiry.sql' ),
34 array( 'recentchanges', 'rc_type', 'patch-rc_type.sql' ),
35 array( 'recentchanges', 'rc_ip', 'patch-rc_ip.sql' ),
36 array( 'recentchanges', 'rc_id', 'patch-rc_id.sql' ),
37 array( 'recentchanges', 'rc_patrolled', 'patch-rc-patrol.sql' ),
38 array( 'user', 'user_real_name', 'patch-user-realname.sql' ),
39 array( 'user', 'user_token', 'patch-user_token.sql' ),
40 array( 'user', 'user_email_token', 'patch-user_email_token.sql' ),
41 array( 'user_rights', 'ur_user', 'patch-rename-user_groups-and_rights.sql' ),
42 array( 'groups', 'gr_rights', 'patch-userlevels-rights.sql' ),
43 array( 'logging', 'log_params', 'patch-log_params.sql' ),
44 array( 'archive', 'ar_rev_id', 'patch-archive-rev_id.sql' ),
45 array( 'archive', 'ar_text_id', 'patch-archive-text_id.sql' ),
46 array( 'page', 'page_len', 'patch-page_len.sql' ),
47 array( 'revision', 'rev_deleted', 'patch-rev_deleted.sql' ),
48 array( 'image', 'img_width', 'patch-img_width.sql' ),
49 array( 'image', 'img_metadata', 'patch-img_metadata.sql' ),
50 array( 'image', 'img_media_type', 'patch-img_media_type.sql' ),
51 array( 'validate', 'val_ip', 'patch-val_ip.sql' ),
52 );
53
54 function rename_table( $from, $to, $patch ) {
55 global $wgDatabase;
56 if ( $wgDatabase->tableExists( $from ) ) {
57 if ( $wgDatabase->tableExists( $to ) ) {
58 echo "...can't move table $from to $to, $to already exists.\n";
59 } else {
60 echo "Moving table $from to $to...";
61 dbsource( "maintenance/archives/$patch", $wgDatabase );
62 echo "ok\n";
63 }
64 } else {
65 // Source table does not exist
66 // Renames are done before creations, so this is typical for a new installation
67 // Ignore silently
68 }
69 }
70
71 function add_table( $name, $patch ) {
72 global $wgDatabase;
73 if ( $wgDatabase->tableExists( $name ) ) {
74 echo "...$name table already exists.\n";
75 } else {
76 echo "Creating $name table...";
77 dbsource( "maintenance/archives/$patch", $wgDatabase );
78 echo "ok\n";
79 }
80 }
81
82 function add_field( $table, $field, $patch ) {
83 global $wgDatabase;
84 if ( !$wgDatabase->tableExists( $table ) ) {
85 echo "...$table table does not exist, skipping new field patch\n";
86 } elseif ( $wgDatabase->fieldExists( $table, $field ) ) {
87 echo "...have $field field in $table table.\n";
88 } else {
89 echo "Adding $field field to table $table...";
90 dbsource( "maintenance/archives/$patch" , $wgDatabase );
91 echo "ok\n";
92 }
93 }
94
95 function do_revision_updates() {
96 global $wgSoftwareRevision;
97 if ( $wgSoftwareRevision < 1001 ) {
98 update_passwords();
99 }
100 }
101
102 function update_passwords() {
103 wfDebugDieBacktrace( "This function needs to be updated or removed.\n" );
104
105 global $wgDatabase;
106 $fname = "Update script: update_passwords()";
107 print "\nIt appears that you need to update the user passwords in your\n" .
108 "database. If you have already done this (if you've run this update\n" .
109 "script once before, for example), doing so again will make all your\n" .
110 "user accounts inaccessible, so be sure you only do this once.\n" .
111 "Update user passwords? (yes/no)";
112
113 $resp = readconsole();
114 if ( ! ( "Y" == $resp{0} || "y" == $resp{0} ) ) { return; }
115
116 $sql = "SELECT user_id,user_password FROM user";
117 $source = $wgDatabase->query( $sql, $fname );
118
119 while ( $row = $wgDatabase->fetchObject( $source ) ) {
120 $id = $row->user_id;
121 $oldpass = $row->user_password;
122 $newpass = md5( "{$id}-{$oldpass}" );
123
124 $sql = "UPDATE user SET user_password='{$newpass}' " .
125 "WHERE user_id={$id}";
126 $wgDatabase->query( $sql, $fname );
127 }
128 }
129
130 function do_interwiki_update() {
131 # Check that interwiki table exists; if it doesn't source it
132 global $wgDatabase;
133 if( $wgDatabase->tableExists( "interwiki" ) ) {
134 echo "...already have interwiki table\n";
135 return true;
136 }
137 echo "Creating interwiki table: ";
138 dbsource( "maintenance/archives/patch-interwiki.sql" );
139 echo "ok\n";
140 echo "Adding default interwiki definitions: ";
141 dbsource( "maintenance/interwiki.sql" );
142 echo "ok\n";
143 }
144
145 function do_index_update() {
146 # Check that proper indexes are in place
147 global $wgDatabase;
148 $meta = $wgDatabase->fieldInfo( "recentchanges", "rc_timestamp" );
149 if( $meta->multiple_key == 0 ) {
150 echo "Updating indexes to 20031107: ";
151 dbsource( "maintenance/archives/patch-indexes.sql" );
152 echo "ok\n";
153 return true;
154 }
155 echo "...indexes seem up to 20031107 standards\n";
156 return false;
157 }
158
159 function do_linkscc_1_3_update() {
160 // Update linkscc table to 1.3 schema if necessary
161 global $wgDatabase, $wgVersion;
162 if( $wgDatabase->tableExists( "linkscc" )
163 && $wgDatabase->fieldExists( "linkscc", "lcc_title" ) ) {
164 echo "Altering lcc_title field from linkscc table... ";
165 dbsource( "maintenance/archives/patch-linkscc-1.3.sql", $wgDatabase );
166 echo "ok\n";
167 } else {
168 echo "...linkscc is up to date, or does not exist. Good.\n";
169 }
170 }
171
172 function do_image_name_unique_update() {
173 global $wgDatabase;
174 if( $wgDatabase->indexExists( 'image', 'PRIMARY' ) ) {
175 echo "...image primary key already set.\n";
176 } else {
177 echo "Making img_name the primary key... ";
178 dbsource( "maintenance/archives/patch-image_name_primary.sql", $wgDatabase );
179 echo "ok\n";
180 }
181 }
182
183 function do_watchlist_update() {
184 global $wgDatabase;
185 if( $wgDatabase->fieldExists( 'watchlist', 'wl_notificationtimestamp' ) ) {
186 echo "ENOTIF: The watchlist table is already set up for email notification.\n";
187 } else {
188 echo "ENOTIF: Adding wl_notificationtimestamp field for email notification management.";
189 /* ALTER TABLE watchlist ADD (wl_notificationtimestamp varchar(14) binary NOT NULL default '0'); */
190 dbsource( "maintenance/archives/patch-email-notification.sql", $wgDatabase );
191 echo "ok\n";
192 }
193 }
194
195 function do_copy_newtalk_to_watchlist() {
196 global $wgDatabase;
197 global $wgCommandLineMode; # this needs to be saved while getID() and getName() are called
198
199 if ( $wgDatabase->tableExists( 'user_newtalk' ) ) {
200 $res = $wgDatabase->safeQuery( 'SELECT user_id, user_ip FROM !',
201 $wgDatabase->tableName( 'user_newtalk' ) );
202 $num_newtalks=$wgDatabase->numRows($res);
203 echo "ENOTIF: Now converting ".$num_newtalks." user_newtalk entries to watchlist table entries ... \n";
204
205 $user = new User();
206 for ( $i = 1; $i <= $num_newtalks; $i++ ) {
207 $wluser = $wgDatabase->fetchObject( $res );
208 echo 'ENOTIF: <= user_newtalk: user_id='.$wluser->user_id.' user_ip='.$wluser->user_ip."\n";
209 if ($wluser->user_id == 0) { # anonymous users ... have IP numbers as "names"
210 if ($user->isIP($wluser->user_ip)) { # do only if it really looks like an IP number (double checked)
211 $wgDatabase->replace( 'watchlist',
212 array(array('wl_user','wl_namespace', 'wl_title', 'wl_notificationtimestamp' )),
213 array('wl_user' => 0,
214 'wl_namespace' => NS_USER_TALK,
215 'wl_title' => $wluser->user_ip,
216 'wl_notificationtimestamp' => '19700101000000'
217 ), 'updaters.inc::do_watchlist_update2'
218 );
219 echo 'ENOTIF: ====> watchlist: user_id=0 '.$wluser->user_ip."\n";
220 }
221 } else { # normal users ... have user_ids
222 $user->setID($wluser->user_id);
223 $wgDatabase->replace( 'watchlist',
224 array(array('wl_user','wl_namespace', 'wl_title', 'wl_notificationtimestamp' )),
225 array('wl_user' => $user->getID(),
226 'wl_namespace' => NS_USER_TALK,
227 'wl_title' => $user->getName(),
228 'wl_notificationtimestamp' => '19700101000000'
229 ), 'updaters.inc::do_watchlist_update3'
230 );
231 echo 'ENOTIF: ====> watchlist: user_id='.$user->getID().' '.$user->getName()."\n";
232 }
233 }
234 echo "ENOTIF: The watchlist table has got the former user_newtalk entries.\n";
235 dbsource( "maintenance/archives/patch-drop-user_newtalk.sql", $wgDatabase );
236 echo "ENOTIF: Deleting the user_newtalk table as its entries are now in the watchlist table.\n";
237 } else {
238 echo "ENOTIF: No user_newtalk table found. Nothing to convert to watchlist table entries.\n";
239 }
240 }
241
242
243 function do_user_update() {
244 global $wgDatabase;
245 if( $wgDatabase->fieldExists( 'user', 'user_emailauthenticationtimestamp' ) ) {
246 echo "User table contains old email authentication field. Dropping... ";
247 dbsource( "maintenance/archives/patch-email-authentication.sql", $wgDatabase );
248 echo "ok\n";
249 } else {
250 echo "...user table does not contain old email authentication field.\n";
251 }
252 }
253
254 # Assumes that the groups table has been added.
255 function do_group_update() {
256 global $wgDatabase;
257 $res = $wgDatabase->safeQuery( 'SELECT COUNT(*) AS c FROM !',
258 $wgDatabase->tableName( 'groups' ) );
259 $row = $wgDatabase->fetchObject( $res );
260 $wgDatabase->freeResult( $res );
261 if( $row->c == 0 ) {
262 echo "Adding default group definitions... ";
263 dbsource( "maintenance/archives/patch-userlevels-defaultgroups.sql", $wgDatabase );
264 echo "ok\n";
265 }
266 }
267
268 /**
269 * 1.4 betas were missing the 'binary' marker from logging.log_title,
270 * which causes a collation mismatch error on joins in MySQL 4.1.
271 */
272 function do_logging_encoding() {
273 global $wgDatabase;
274 $logging = $wgDatabase->tableName( 'logging' );
275 $res = $wgDatabase->query( "SELECT log_title FROM $logging LIMIT 0" );
276 $flags = explode( ' ', mysql_field_flags( $res, 0 ) );
277 $wgDatabase->freeResult( $res );
278
279 if( in_array( 'binary', $flags ) ) {
280 echo "Logging table has correct title encoding.\n";
281 } else {
282 echo "Fixing title encoding on logging table... ";
283 dbsource( 'maintenance/archives/patch-logging-title.sql', $wgDatabase );
284 echo "ok\n";
285 }
286 }
287
288 function do_schema_restructuring() {
289 global $wgDatabase;
290 $fname="do_schema_restructuring";
291 if ( $wgDatabase->tableExists( 'page' ) ) {
292 echo "...page table already exists.\n";
293 } else {
294 echo "...converting from cur/old to page/revision/text DB structure.\n"; flush();
295 echo wfTimestamp();
296 echo "......checking for duplicate entries.\n"; flush();
297
298 extract( $wgDatabase->tableNames( 'cur', 'old', 'page', 'revision', 'text' ) );
299
300 $rows = $wgDatabase->query( "SELECT cur_title, cur_namespace, COUNT(cur_namespace) AS c
301 FROM $cur GROUP BY cur_title, cur_namespace HAVING c>1", $fname );
302
303 if ( $wgDatabase->numRows( $rows ) > 0 ) {
304 echo wfTimestamp();
305 echo "......<b>Found duplicate entries</b>\n";
306 echo ( sprintf( "<b> %-60s %3s %5s</b>\n", 'Title', 'NS', 'Count' ) );
307 while ( $row = $wgDatabase->fetchObject( $rows ) ) {
308 if ( ! isset( $duplicate[$row->cur_namespace] ) ) {
309 $duplicate[$row->cur_namespace] = array();
310 }
311 $duplicate[$row->cur_namespace][] = $row->cur_title;
312 echo ( sprintf( " %-60s %3s %5s\n", $row->cur_title, $row->cur_namespace, $row->c ) );
313 }
314 $sql = "SELECT cur_title, cur_namespace, cur_id, cur_timestamp FROM $cur WHERE ";
315 $firstCond = true;
316 foreach ( $duplicate as $ns => $titles ) {
317 if ( $firstCond ) {
318 $firstCond = false;
319 } else {
320 $sql .= ' OR ';
321 }
322 $sql .= "( cur_namespace = {$ns} AND cur_title in (";
323 $first = true;
324 foreach ( $titles as $t ) {
325 if ( $first ) {
326 $sql .= $wgDatabase->addQuotes( $t );
327 $first = false;
328 } else {
329 $sql .= ', ' . $wgDatabase->addQuotes( $t );
330 }
331 }
332 $sql .= ") ) \n";
333 }
334 # By sorting descending, the most recent entry will be the first in the list.
335 # All following entries will be deleted by the next while-loop.
336 $sql .= 'ORDER BY cur_namespace, cur_title, cur_timestamp DESC';
337
338 $rows = $wgDatabase->query( $sql, $fname );
339
340 $prev_title = $prev_namespace = false;
341 $deleteId = array();
342
343 while ( $row = $wgDatabase->fetchObject( $rows ) ) {
344 if ( $prev_title == $row->cur_title && $prev_namespace == $row->cur_namespace ) {
345 $deleteId[] = $row->cur_id;
346 }
347 $prev_title = $row->cur_title;
348 $prev_namespace = $row->cur_namespace;
349 }
350 $sql = "DELETE FROM $cur WHERE cur_id IN ( " . join( ',', $deleteId ) . ')';
351 $rows = $wgDatabase->query( $sql, $fname );
352 echo wfTimestamp();
353 echo "......<b>Deleted</b> ".$wgDatabase->affectedRows()." records.\n";
354 }
355
356
357 echo wfTimestamp();
358 echo "......Creating tables.\n";
359 $wgDatabase->query("CREATE TABLE $page (
360 page_id int(8) unsigned NOT NULL auto_increment,
361 page_namespace int NOT NULL,
362 page_title varchar(255) binary NOT NULL,
363 page_restrictions tinyblob NOT NULL default '',
364 page_counter bigint(20) unsigned NOT NULL default '0',
365 page_is_redirect tinyint(1) unsigned NOT NULL default '0',
366 page_is_new tinyint(1) unsigned NOT NULL default '0',
367 page_random real unsigned NOT NULL,
368 page_touched char(14) binary NOT NULL default '',
369 page_latest int(8) unsigned NOT NULL,
370 page_len int(8) unsigned NOT NULL,
371
372 PRIMARY KEY page_id (page_id),
373 UNIQUE INDEX name_title (page_namespace,page_title),
374 INDEX (page_random),
375 INDEX (page_len)
376 ) TYPE=InnoDB", $fname );
377 $wgDatabase->query("CREATE TABLE $revision (
378 rev_id int(8) unsigned NOT NULL auto_increment,
379 rev_page int(8) unsigned NOT NULL,
380 rev_comment tinyblob NOT NULL default '',
381 rev_user int(5) unsigned NOT NULL default '0',
382 rev_user_text varchar(255) binary NOT NULL default '',
383 rev_timestamp char(14) binary NOT NULL default '',
384 rev_minor_edit tinyint(1) unsigned NOT NULL default '0',
385 rev_deleted tinyint(1) unsigned NOT NULL default '0',
386
387 PRIMARY KEY rev_page_id (rev_page, rev_id),
388 UNIQUE INDEX rev_id (rev_id),
389 INDEX rev_timestamp (rev_timestamp),
390 INDEX page_timestamp (rev_page,rev_timestamp),
391 INDEX user_timestamp (rev_user,rev_timestamp),
392 INDEX usertext_timestamp (rev_user_text,rev_timestamp)
393 ) TYPE=InnoDB", $fname );
394
395 echo wfTimestamp();
396 echo "......Locking tables.\n";
397 $wgDatabase->query( "LOCK TABLES $page WRITE, $revision WRITE, $old WRITE, $cur WRITE", $fname );
398
399 $maxold = $wgDatabase->selectField( 'old', 'max(old_id)', '', $fname );
400 echo wfTimestamp();
401 echo "......maxold is {$maxold}\n";
402
403 echo wfTimestamp();
404 global $wgLegacySchemaConversion;
405 if( $wgLegacySchemaConversion ) {
406 // Create HistoryBlobCurStub entries.
407 // Text will be pulled from the leftover 'cur' table at runtime.
408 echo "......Moving metadata from cur; using blob references to text in cur table.\n";
409 $cur_text = "concat('O:18:\"historyblobcurstub\":1:{s:6:\"mCurId\";i:',cur_id,';}')";
410 $cur_flags = "'object'";
411 } else {
412 // Copy all cur text in immediately: this may take longer but avoids
413 // having to keep an extra table around.
414 echo "......Moving text from cur.\n";
415 $cur_text = 'cur_text';
416 $cur_flags = "''";
417 }
418 $wgDatabase->query( "INSERT INTO $old (old_namespace, old_title, old_text, old_comment, old_user, old_user_text,
419 old_timestamp, old_minor_edit, old_flags)
420 SELECT cur_namespace, cur_title, $cur_text, cur_comment, cur_user, cur_user_text, cur_timestamp, cur_minor_edit, $cur_flags
421 FROM $cur", $fname );
422
423 echo wfTimestamp();
424 echo "......Setting up revision table.\n";
425 $wgDatabase->query( "INSERT INTO $revision (rev_id, rev_page, rev_comment, rev_user, rev_user_text, rev_timestamp,
426 rev_minor_edit)
427 SELECT old_id, cur_id, old_comment, old_user, old_user_text,
428 old_timestamp, old_minor_edit
429 FROM $old,$cur WHERE old_namespace=cur_namespace AND old_title=cur_title", $fname );
430
431 echo wfTimestamp();
432 echo "......Setting up page table.\n";
433 $wgDatabase->query( "INSERT INTO $page (page_id, page_namespace, page_title, page_restrictions, page_counter,
434 page_is_redirect, page_is_new, page_random, page_touched, page_latest, page_len)
435 SELECT cur_id, cur_namespace, cur_title, cur_restrictions, cur_counter, cur_is_redirect, cur_is_new,
436 cur_random, cur_touched, rev_id, LENGTH(cur_text)
437 FROM $cur,$revision
438 WHERE cur_id=rev_page AND rev_timestamp=cur_timestamp AND rev_id > {$maxold}", $fname );
439
440 echo wfTimestamp();
441 echo "......Unlocking tables.\n";
442 $wgDatabase->query( "UNLOCK TABLES", $fname );
443
444 echo wfTimestamp();
445 echo "......Renaming old.\n";
446 $wgDatabase->query( "ALTER TABLE $old RENAME TO $text", $fname );
447
448 echo wfTimestamp();
449 echo "...done.\n";
450 }
451 }
452
453 function do_inverse_timestamp() {
454 global $wgDatabase;
455 $fname="do_schema_restructuring";
456 if( $wgDatabase->fieldExists( 'revision', 'inverse_timestamp' ) ) {
457 echo "Removing revision.inverse_timestamp and fixing indexes... ";
458 dbsource( 'maintenance/archives/patch-inverse_timestamp.sql', $wgDatabase );
459 echo "ok\n";
460 } else {
461 echo "revision timestamp indexes already up to 2005-03-13\n";
462 }
463 }
464
465 function do_text_id() {
466 global $wgDatabase;
467 if( $wgDatabase->fieldExists( 'revision', 'rev_text_id' ) ) {
468 echo "...rev_text_id already in place.\n";
469 } else {
470 echo "Adding rev_text_id field... ";
471 dbsource( 'maintenance/archives/patch-rev_text_id.sql', $wgDatabase );
472 echo "ok\n";
473 }
474 }
475
476 function do_namespace_size() {
477 $tables = array(
478 'page' => 'page',
479 'archive' => 'ar',
480 'recentchanges' => 'rc',
481 'watchlist' => 'wl',
482 'querycache' => 'qc',
483 'logging' => 'log',
484 );
485 foreach( $tables as $table => $prefix ) {
486 do_namespace_size_on( $table, $prefix );
487 flush();
488 }
489 }
490
491 function do_namespace_size_on( $table, $prefix ) {
492 global $wgDatabase;
493 $field = $prefix . '_namespace';
494
495 $tablename = $wgDatabase->tableName( $table );
496 $result = $wgDatabase->query( "SHOW COLUMNS FROM $tablename LIKE '$field'" );
497 $info = $wgDatabase->fetchObject( $result );
498 $wgDatabase->freeResult( $result );
499
500 if( substr( $info->Type, 0, 3 ) == 'int' ) {
501 echo "...$field is already a full int ($info->Type).\n";
502 } else {
503 echo "Promoting $field from $info->Type to int... ";
504
505 $sql = "ALTER TABLE $tablename MODIFY $field int NOT NULL";
506 $wgDatabase->query( $sql );
507
508 echo "ok\n";
509 }
510 }
511
512 function do_pagelinks_update() {
513 global $wgDatabase;
514 if( $wgDatabase->tableExists( 'pagelinks' ) ) {
515 echo "...already have pagelinks table.\n";
516 } else {
517 echo "Converting links and brokenlinks tables to pagelinks... ";
518 dbsource( "maintenance/archives/patch-pagelinks.sql", $wgDatabase );
519 echo "ok\n";
520 flush();
521
522 global $wgCanonicalNamespaceNames;
523 foreach( $wgCanonicalNamespaceNames as $ns => $name ) {
524 if( $ns != 0 ) {
525 do_pagelinks_namespace( $ns );
526 }
527 }
528 }
529 }
530
531 function do_pagelinks_namespace( $namespace ) {
532 global $wgDatabase, $wgContLang;
533
534 $ns = IntVal( $namespace );
535 echo "Cleaning up broken links for namespace $ns... ";
536
537 $pagelinks = $wgDatabase->tableName( 'pagelinks' );
538 $name = $wgContLang->getNsText( $ns );
539 $prefix = $wgDatabase->strencode( $name );
540 $likeprefix = str_replace( '_', '\\_', $prefix);
541
542 $sql = "UPDATE $pagelinks
543 SET pl_namespace=$ns,
544 pl_title=TRIM(LEADING '$prefix:' FROM pl_title)
545 WHERE pl_namespace=0
546 AND pl_title LIKE '$likeprefix:%'";
547
548 $wgDatabase->query( $sql, 'do_pagelinks_namespace' );
549 echo "ok\n";
550 }
551
552 function do_all_updates() {
553 global $wgNewTables, $wgNewFields, $wgRenamedTables;
554
555 # Rename tables
556 foreach ( $wgRenamedTables as $tableRecord ) {
557 rename_table( $tableRecord[0], $tableRecord[1], $tableRecord[2] );
558 }
559
560 # Add missing tables
561 foreach ( $wgNewTables as $tableRecord ) {
562 add_table( $tableRecord[0], $tableRecord[1] );
563 flush();
564 }
565
566 # Add missing fields
567 foreach ( $wgNewFields as $fieldRecord ) {
568 add_field( $fieldRecord[0], $fieldRecord[1], $fieldRecord[2] );
569 flush();
570 }
571
572 # Add default group data
573 do_group_update(); flush();
574
575 # Do schema updates which require special handling
576 do_interwiki_update(); flush();
577 do_index_update(); flush();
578 do_linkscc_1_3_update(); flush();
579 convertLinks(); flush();
580 do_image_name_unique_update(); flush();
581 do_watchlist_update(); flush();
582 do_user_update(); flush();
583 do_copy_newtalk_to_watchlist(); flush();
584 do_logging_encoding(); flush();
585
586 do_schema_restructuring(); flush();
587 do_inverse_timestamp(); flush();
588 do_text_id(); flush();
589 do_namespace_size(); flush();
590
591 do_pagelinks_update(); flush();
592
593 initialiseMessages(); flush();
594 }
595
596 ?>